Fix mac nightly builds
authorAlex Crichton <alex@alexcrichton.com>
Tue, 16 Dec 2014 17:18:40 +0000 (09:18 -0800)
committerAlex Crichton <alex@alexcrichton.com>
Tue, 16 Dec 2014 17:23:56 +0000 (09:23 -0800)
Older versions of curl apparently don't peel off the query parameters when
looking up filenames, so make two copies of the search results file in hope that
curl will find one of them!

tests/test_cargo_search.rs

index 83cebb433bbd60594d03f84cbb63dbd665d01cb5..c2cf6a70512973c47b9e71f872b541cab0d0c2fb 100644 (file)
@@ -39,8 +39,7 @@ fn cargo_process(s: &str) -> ProcessBuilder {
 }
 
 test!(simple {
-    let crates = api_path().join("api/v1/crates");
-    File::create(&crates).write_str(r#"{
+    let contents = r#"{
         "crates": [{
             "created_at": "2014-11-16T20:17:35Z",
             "description": "Design by contract style assertions for Rust",
@@ -65,7 +64,19 @@ test!(simple {
         "meta": {
             "total": 1
         }
-    }"#).assert();
+    }"#;
+    let base = api_path().join("api/v1/crates");
+
+    // Older versions of curl don't peel off query parameters when looking for
+    // filenames, so just make both files.
+    //
+    // On windows, though, `?` is an invalid character, but we always build curl
+    // from source there anyway!
+    File::create(&base).write_str(contents).unwrap();
+    if !cfg!(windows) {
+        File::create(&base.with_filename("crates?q=postgres"))
+             .write_str(contents).unwrap();
+    }
 
     assert_that(cargo_process("search").arg("postgres"),
                 execs().with_status(0).with_stdout(format!("\